package com.example.anew.journey.mynewjourney.firstchangelogic.firstChangeChangePhoneNumber;

import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import com.example.anew.journey.mynewjourney.R;
import com.example.anew.journey.mynewjourney.base.FirstChangeAllBaseActivity;
import com.example.anew.journey.mynewjourney.firstchangelogic.firstChangeChangePhoneNumber.persenter.FirstChangeChangePhoneNumberPersenter;
import com.example.anew.journey.mynewjourney.firstchangelogic.firstChangeChangePhoneNumber.view.ISFirstChangeChangePhoneNumberView;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 杭州惟君医疗科技有限公司15
 * Created by 20433 on 2018/3/16
 */

public class FirstChangeChangePhoneNumberActivity extends FirstChangeAllBaseActivity implements ISFirstChangeChangePhoneNumberView {
    @Bind(R.id.activity_first_change_phone_number_et_input_phone_number)
    EditText activityFirstChangePhoneNumberEtInputPhoneNumber;
    @Bind(R.id.activity_first_change_phone_number_et_input_version_code)
    EditText activityFirstChangePhoneNumberEtInputVersionCode;
    @Bind(R.id.activity_first_change_phone_number_tv_get_version_code)
    TextView activityFirstChangePhoneNumberTvGetVersionCode;
    @Bind(R.id.activity_first_change_phone_number_bt_complete)
    Button activityFirstChangePhoneNumberBtComplete;
    private View view;
    private FirstChangeChangePhoneNumberPersenter mFirstChangeChangePhoneNumberPersenter = new FirstChangeChangePhoneNumberPersenter(this);

    /**
     * @desc 主要内容的布局资源填充进来
     */
    @Override
    protected View setMainContentView() {
        view = View.inflate(this, R.layout.activity_first_change_phone_number, null);
        ButterKnife.bind(this, view);
        return view;
    }

    /**
     * @desc 初始化数据 onCreate()
     */
    @Override
    protected void initView(View view) {
        displayToolbar();
        displayReturn();
        displayTvName();

        setToolbarBg(0xff2196F3);
        setReturnrePictuResources(R.mipmap.return_02);
        setTvNameEachAttribute(20, 0xffffffff, "更换手机号");
    }

    /**
     * @desc Activity 销毁 释放资源
     */
    @Override
    protected void releaseResources() {
        ButterKnife.unbind(view);
    }

    /**
     * @desc 网络监听 用于提示用户有网络了
     */
    @Override
    protected void promptHaveInternet() {

    }

    /**
     * @desc 网络监听 用于提示用户没有网络了
     */
    @Override
    protected void promptNoInternet() {

    }

    /**
     * @desc 点击分享按钮
     */
    @Override
    protected void onClickShared() {

    }

    /**
     * @desc 点击发布按钮
     */
    @Override
    protected void onClickRelease() {

    }

    /**
     * @desc 点击返回按钮
     */
    @Override
    protected void onClickReturn() {
        finish();
    }


    @OnClick({R.id.activity_first_change_phone_number_tv_get_version_code, R.id.activity_first_change_phone_number_bt_complete})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.activity_first_change_phone_number_tv_get_version_code:
                mFirstChangeChangePhoneNumberPersenter.onClickeGetVersionCode();
                break;
            case R.id.activity_first_change_phone_number_bt_complete:
                mFirstChangeChangePhoneNumberPersenter.onClickbBtComplete(this);
                break;
        }
    }
    // 获取输入的手机号
    @Override
    public String getInputPhoneNumber() {
        return activityFirstChangePhoneNumberEtInputPhoneNumber.getText().toString().trim();
    }
    //设置输入的手机号
    @Override
    public void setInputPhoneNumber(String str) {
        activityFirstChangePhoneNumberEtInputPhoneNumber.setText(str);
    }
    // 获取输入的验证码
    @Override
    public String getInputVersionCode() {
        return activityFirstChangePhoneNumberEtInputVersionCode.getText().toString().trim();
    }
    //设置输入的验证码
    @Override
    public void setInputVersionCode(String str) {
        activityFirstChangePhoneNumberEtInputVersionCode.setText(str);
    }
    // 显示提示Toast信息
    @Override
    public void showToastInformation(String str) {
        Toast.makeText(this,str,Toast.LENGTH_SHORT).show();
    }
    // 显示进度
    @Override
    public void displayProgress() {

    }
    // 隐藏进度
    @Override
    public void hiddenProgress() {

    }
    //完成
    @Override
    public void onClickeComplete() {
        finish();
    }
    //设置 验证码
    @Override
    public void setVersionCode(String str) {
        activityFirstChangePhoneNumberTvGetVersionCode.setText(str);
    }
}
